Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fast-average-color

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fast-average-color

A simple library that calculates the average color of images, videos and canvas in browser environment.

  • 6.4.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
73K
increased by18.78%
Maintainers
1
Weekly downloads
 
Created
Source

Fast Average Color

NPM version NPM Downloads Dependency Status bundlephobia

A simple library that calculates the average color of any images or videos in browser environment.

Features

  • Bet on speed
  • Some algorithms: simple, sqrt (default) and dominant
  • Small bundle size, tree shaking
  • Average color can be obtained from:
    • image
    • string (url of image)
    • video
    • canvas
    • array of numbers, Uint8Array or Uint8ClampedArray
  • Average color can be obtained from specific part of resource
  • Support for transparency (PNG, SVG and other formats)
  • Support for web workers
  • Support for Node.js

Table of contents

Unhandled Rejection (SecurityError): The operation is insecure.

The crossOrigin attribute allows images that are loaded from external origins to be used in canvas like the one they were being loaded from the current origin. Using images without CORS approval taints the canvas. Once a canvas has been tainted, you can no longer pull data back out of the canvas. By loading the canvas from cross origin domain, you are tainting the canvas.

You can prevent this by setting crossorigin="anonymous".

More examples

See code

License

MIT License

Keywords

FAQs

Package last updated on 04 Sep 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc